//
//  WebDetailViewController.m
//  Funny
//
//  Created by dllo on 15/11/2.
//  Copyright © 2015年 King. All rights reserved.
//

#import "WebDetailViewController.h"

@interface WebDetailViewController ()
@property (nonatomic, strong) UIWebView *webView;
@end

@implementation WebDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - 15)];
   
    NSString *str = [NSString stringWithFormat:@"http://appapi.yaochufa.com/v2/Product"];
    NSURL *url = [NSURL URLWithString:str];
    
    self.webView.scalesPageToFit = YES;
    self.webView.scrollView.showsVerticalScrollIndicator = NO;
    NSString *jsString = @"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '800%'";
    [_webView stringByEvaluatingJavaScriptFromString:jsString];
    [_webView loadHTMLString:self.addressStr baseURL:url];
    NSLog(@"%@", self.addressStr);
   
    [self.view addSubview:_webView];
   
}

- (void)viewWillDisappear:(BOOL)animated
{
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
    [self.webView removeFromSuperview];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
